package cn.zhouchao.fallback;

import cn.zhouchao.domain.Store;
import cn.zhouchao.feign.StoreService;
import cn.zhouchao.utils.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class StoreServiceFallbackFactory implements FallbackFactory<StoreService> {

    @Override
    public StoreService create(Throwable throwable) {
        return new StoreService() {
            @Override
            public AjaxResult add(Store store) {
                return new AjaxResult("熔断了！！！", false, "请稍后再试！！！");
            }
        };
    }
}
